<?php
namespace Home\Controller;
class FeedbackController extends CommonController{

	public function win_submit(){
		$type      = $this->_get('type', '', 'free_agreement');
		$object_id = $this->_get('object_id');
		if(IS_POST){
			$category_id = $this->_post('category_id');
			$content     = $this->_post('content', '请填写反馈内容！');
			D('Feedback')->submit(
				$this->user_id,
				'', 
				$category_id, 
				$type, 
				$object_id, 
				$content
			);
			$this->success('提交成功，感谢您的反馈！');
		}
		$this->display();
	}
	public function submit(){
		if(IS_POST){
			$category_id = $this->_post('category_id', '请选择反馈类型！');
			$content     = $this->_post('content', '请填写反馈内容！');
			$contact     = $this->_post('phone', '请填写手机号码！');
			D('Feedback')->submit(
				$this->user_id,
				'',
				$category_id,
				'web_feedback',
				'', 
				$content,
				$contact,
				$this->user_realname
			);
			$this->success('提交成功，感谢您的反馈！');
		}
	}
	// 期权激励咨询
	public function eso(){
		$this->add_step('期权激励咨询');
		if(IS_POST){
			$content  = $this->_post('content', '请填写问题描述！');
			$realname = $this->_post('realname', '请填写联系人！');
			$mobile   = $this->_post('mobile', '请填写联系电话！');
			if(preg_match('/^1[34578][0-9]{9}$/', $mobile) == false){
				$this->error('对不起，您输入手机号不正确！');
			}
			D('Feedback')->submit(
				$this->user_id,
				'',
				0,
				'eso',
				'',
				$content,
				$mobile,
				$realname
			);
			$this->success('提交成功！');
		}
		$this->feedback_list = D('Feedback')->where(array('type' => 'eso'))->order('id desc')->limit(10)->select();
		$this->display();
	}
	public function equity_incentive(){
		$this->add_step('股权激励方案设计');
		if(IS_POST){
			$realname = $this->_post('realname', '请填写联系人！');
			$mobile   = $this->_post('mobile', '请填写联系电话！');
			$content  = $this->_post('content', '请填写单位名称！');
			if(preg_match('/^1[34578][0-9]{9}$/', $mobile) == false){
				$this->error('对不起，您输入手机号不正确！');
			}
			D('Feedback')->submit(
				$this->user_id,
				'',
				0,
				'equity_incentive',
				'',
				$content,
				$mobile,
				$realname
			);
			$this->success('提交成功！');
		}
		$this->display();
	}
}